<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2022/5/6
  Time: 19:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
  <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/modules/code.css">
  <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/modules/layer/default/layer.css">
  <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/modules/laydate/default/laydate.css">

  <style type="text/css">
      .layui-table-cell {
          height: 36px;
          line-height: 36px;
      }
  </style>

</head>
<body>
<div class="layui-header">
  <div class="layui-logo">图书管理系统</div>
  <!-- 头部区域（可配合layui已有的水平导航） -->
  <ul class="layui-nav layui-layout-left" lay-filter="">

    <c:if test="${admin!=null}">
      <li class="layui-nav-item">
        <a href="javascript:;">图书管理</a>
        <dl class="layui-nav-child ">
          <dd><a href="${pageContext.request.contextPath}/toMain">图书列表</a></dd>
          <dd><a href="${pageContext.request.contextPath}/book/toType">分类管理</a></dd>
        </dl>
      </li>
      <li class="layui-nav-item"><a href="${pageContext.request.contextPath}/reader/toReader">读者列表</a></li>
      <li class="layui-nav-item"><a href="${pageContext.request.contextPath}/lend/toLendList">借阅管理</a></li>
      <li class="layui-nav-item"><a onclick="changePwd('0');">修改密码</a></li>
    </c:if>
    <c:if test="${reader!=null}">
      <li class="layui-nav-item"><a href="${pageContext.request.contextPath}/toReaderMain">图书列表</a></li>
      <li class="layui-nav-item"><a href="${pageContext.request.contextPath}/lend/toLendList">借阅记录</a></li>
      <li class="layui-nav-item"><a onclick="changePwd('1');">修改密码</a></li>
    </c:if>
  </ul>
  <ul class="layui-nav layui-layout-right">
    <li class="layui-nav-item">
      <a href="javascript:;">
        <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
        <%--${admin2.name }--%>
        <c:if test="${admin != null}">
          ${admin.name}
        </c:if>
        <c:if test="${reader != null}">
          ${reader.name}
        </c:if>
      </a>
    </li>
    <li class="layui-nav-item"><a href="${pageContext.request.contextPath}/logout">退出</a></li>
  </ul>
</div>
<div style="padding: 20px;"></div>


</body>


<script type="text/javascript" src="${pageContext.request.contextPath}/layui/layui.js"></script>
<script type="text/javascript">
  // 解决：当退出登录后，点击浏览器的返回不能返回到之前的页面上。
	history.go(1);

	// 尝试让网站适配手机------本次失败😅
  (function() {
	  function autoRootFontSize() {
		  document.documentElement.style.fontSize =Math.min(screen.width,document.documentElement.getBoundingClientRect().width) / 750 * 32 + 'px';
// 取screen.width和document.documentElement.getBoundingClientRect().width的最小值；除以750，乘以32，就是原本是750大小的32px;
// 如果屏幕大小变成了375px,那么字体就是16px;也就是根字体fontSize大小和屏幕大小成正比变化！
	  }
	  window.addEventListener('resize', autoRootFontSize);
	  autoRootFontSize();
  })();

	function changePwd(state) {
		layer.open({
			type: 2,
			title: '修改密码',
			skin: 'layui-layer-demo', //加上边框
			area: ['500px', '300px'], //宽高
			content: '${pageContext.request.contextPath}/updatePwd?state=' + state
		})
	}
</script>
</html>
